//
//  ShapeDecorator.m
//  装饰器模式
//
//  Created by flannery on 2018/12/19.
//  Copyright © 2018年 flannery. All rights reserved.
//

#import "ShapeDecorator.h"

@implementation ShapeDecorator
- (instancetype)initWitShape:(Shape *)decoratedShape{
    if(self = [super init]) {
        self.decoratedShape = decoratedShape;
    }
    return self;
}

- (void)draw{
    [self.decoratedShape draw];
}
@end


@implementation RedShapeDecorator
- (instancetype)initWitShape:(Shape *)decoratedShape{
    if(self = [super init]) {
        self.decoratedShape = decoratedShape;
    }
    return  self;
}

- (void)draw{
    [self.decoratedShape draw];
    [self setDecoratedShape:self.decoratedShape];
}

- (void)setDecoratedShape:(Shape *)decoratedShape{
    super.decoratedShape = decoratedShape;
    NSLog(@"Border Color: Red");
}
@end
